<?php

use yii\db\Migration;

/**
 * Class m201027_093205_rbac_update_alias
 */
class m210120_152444_rbac_update_alias extends Migration
{
    /**
     * {@inheritdoc}
     */
    public function safeUp()
    {
        $auth = Yii::$app->authManager;

        $permission = $auth->createPermission('updateAlias');
        $auth->add($permission);

        $administratorRole = $auth->getRole('admin');
        $auth->addChild($administratorRole, $permission);
    }

    /**
     * {@inheritdoc}
     */
    public function safeDown()
    {
        $auth = Yii::$app->authManager;

        $auth->remove($auth->getPermission('updateAlias'));
    }

}
